Skip to main content

Instrument Repository

Stores information about the currently selected instrument. The instrument is represented as an object of the class com.devexperts.dxcharts.provider.domain.InstrumentData.

Repository interface:

interface InstrumentRepository {
/**
* Method to set the selected instrument.
*/
fun setSelectedInstrument(instrument: InstrumentData)
/**
* Method to get the selected instrument.
*/
fun getSelectedInstrument(): InstrumentData
}
/****/
/**
* Data class for storing data about instruments
*
* @param type type of instrument (f.e. STOCK, CRYPTO)
* @param symbol symbol of instrument (f.e. GOOG, TSLA, AAPL)
* @param description description of instrument (f.e. Alphabet Inc. - Class C Capital Stock)
* @param country short name of a country of the instrument (f.e. US)
* @param currency short name of a currency of the instrument (f.e. USD)
* @param priceIncrements minimal price increments of the instrument (f.e. 0.01)
* @param schedule parsed trading hours of the instrument
*/
data class InstrumentData(
val type: String,
val symbol: String,
val description: String,
val country: String,
val currency: String,
val priceIncrements: String,
val schedule: Schedule? = null,
) {
companion object {
/**
* Empty instrument data
*/
val NONE = InstrumentData(
"",
"",
"",
"",
"",
"",
)
}
}